﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace Marmat.Foundation
{
    public class SelectionRecordFormDrawCellEventArgs : System.EventArgs
    {
        private readonly Action defaultDraw;


        public SelectionRecordFormDrawCellEventArgs(Graphics graphics, Rectangle bounds, object row, string columnName, object cellValue)
        {
            this.Graphics = graphics;
            this.Row = row;
            this.ColumnName = columnName;
            this.CellValue = cellValue;
            this.Bounds = bounds;
        }

        public SelectionRecordFormDrawCellEventArgs(Graphics graphics, Rectangle bounds, object row, string columnName, object cellValue,Action defaultDraw)
        {
            this.Graphics = graphics;
            this.Row = row;
            this.ColumnName = columnName;
            this.CellValue = cellValue;
            this.defaultDraw = defaultDraw;
            this.Bounds = bounds;
        }

        public void DefaultDraw()
        {
            this?.defaultDraw();
        }

        public System.Drawing.Graphics Graphics { get; }

        public string DisplayText { get; set; }

        public object CellValue { get; }

        public Rectangle Bounds { get; }

        public object Row { get; }

        public string ColumnName { get; }

        /// <summary>
        /// 获取或设置一个值，该值指定是否处理了事件并将其作为默认值，因此不需要元素绘制。
        /// </summary>
        /// <returns>如果不需要绘制默认元素，则为true；否则为false。</returns>
        public bool Handled { get; set; }
    }
}
